<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich" %>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %> 


<script type="text/javascript">
    var open_cur = 0;
    $j = jQuery.noConflict();           
    $j(document).ready(function(){
        $j('.keysearch1').live('keyup',function(){
            if($j('.keysearch1').val() == ""){
                $j('.rich-table-row').show();
                                   
            }else{
                $j('.rich-table-row').hide();
                $j('.rich-table-row').each(function(){
                    html = $j(this).html();
                    if(   ununicode(html).indexOf(  ununicode($j('.keysearch1').val()) ) > -1    )  {
                        $j(this).show();
                    }else{
                        $j(this).hide();
                    }
                });
            }

        });
        $j(".rich-table-row:odd").addClass("odd");
        $j('input#leavedate1').datepicker({ dateFormat: 'dd/mm/yy', showOn: 'button', buttonImage: '../images/calenda_icon.gif', buttonImageOnly: true }); 
        $j(".saveCustomerAJ").live("click",function(){
            $j(".mesage").text("");
            nv108 = $j(this).parent(".popup-footer").parent(".addEm").find(".nv108").children("option:selected").val();
            nv102 = $j(this).parent(".popup-footer").parent(".addEm").find(".nv102").val();
            nv127 = $j(this).parent(".popup-footer").parent(".addEm").find(".nv127").val();
            nv107 =   $j("#formPesonal input[type='radio']:checked").val();                     
            nv103 = $j(this).parent(".popup-footer").parent(".addEm").find(".nv103").val();
            nd118 = $j(this).parent(".popup-footer").parent(".addEm").find(".nd118").val();
            nv109 = $j(this).parent(".popup-footer").parent(".addEm").find(".nv109").children("option:selected").val();
            fk300 = $j(this).parent(".popup-footer").parent(".addEm").find(".fk300").children("option:selected").val();
            fk330 = $j(this).parent(".popup-footer").parent(".addEm").find(".fk330").children("option:selected").val();
            fk100 = $j("#formPesonal\\:FK100").val();
            if(fk100==0){
                return false;
            }
            $j.post("actionCustomer.jsp?action=saveCustomerCOM&fk100="+fk100+"&nv108="+nv108+"&nv102="+nv102+"&nv103="+nv103+"&nv127="+nv127+"&nv107="+nv107+"&nd118="+nd118+"&nv109="+nv109+"&fn600=3&nn117=1&fk300="+fk300+"&fk330="+fk330+"",function(data){
                if(data != null)      {
                    $j(".mesage").text("Cập nhật thành công !");
                }
            });
        });
        
        $j(".buttonsave2").live('click',function(data){
            $j(".mesage").text("");
        });
        
        $j(".buttonsave").live('click',function(data){
            // alert("alo");
        });
        $j('.buttonsearch').live('click',function(){
                       
            $j.post("pageemployeeInput.jsp?action=reloadEmp",function(data){
                if(data!=null){
                    $j(".aaaa").html(data);
                }else{
                    $j(".aaaa").html(data);
                }
                //reload lai danh sach khach hang ca nhan sau khi them nhan vien tren popup
                              
            });
        });
                    
        
                
    });
</script> 
<style>
    .cus_comp{
        width: 98% !important;
    }
    .selectedp{
        margin-left: 22px;
    }
    .odd{

    }
    .buttonsearch{
        margin-left: -28px;
        margin-top: 1px;
        position: absolute;
    }
</style>
<f:view>
    <f:loadBundle basename="#{environmentSession.localizationSource}" var="locale"/>
    <a4j:form>
        <div class="fromsearch">
            <div class="fast_search1">
                <h:inputText value="#{CustomerBean.keysearchKH}" onfocus="if(this.value=='')this.value='';" styleClass="keysearch1"  style="width:256px;margin-left: 222px;"/>
                <a4j:commandButton  value='' actionListener="#{CustomerBean.reloadform}"
                                    onclick="showPleaseWait();"
                                    oncomplete="hidePleaseWait();" 
                                    styleClass="buttonsearch" reRender="message6,search,fromMain"  />

            </div>
        </div>
    </a4j:form>
    <a4j:form id="formPesonal" >     


        <div class="buttonsave1">
            <span><h:outputText value="Thêm nhân viên"/></span>
        </div>
        <%--
        <div class="buttonsave3">
            <span><h:outputText value="Người đại diện"/></span>
        </div>--%>
        <div class="buttonsave2">
            <span><h:outputText value="Tìm kiếm"/></span>
        </div>
        <div id="searchEm">


            <div class="resultSearch">&nbsp; 
                <div class="aaaa"></div>
                <div class="popup-footer" style="height:40px;">
                    <h:inputHidden value="#{k100Controller.PK100}" id="FK100"/>
                    <h:outputText value="#{customerExpand.mesage}" id="mesageaa" styleClass="mesage"/>
                    <%--
                                                            <a4j:commandButton  value='#{locale.save}' action="#{customerExpand.saveSelected1}"
                                                                                onclick="showPleaseWait();"
                                                                                oncomplete="hidePleaseWait();" style="margin-right:16px;"
                                                                                styleClass="buttonsave" reRender="mesageaa" >
                                                                <f:param value="#{k100Controller.PK100}" name="PK100"/>
                                                                <f:param value="3" name="FN600"/>
                                                            </a4j:commandButton>--%>
                </div>
            </div>


        </div>
        <h:panelGroup id="fromMain"  >
            <%--
            <div class="addPersonDD">
                <h:panelGroup>                                   
                    <div class="form-left">
                        <div class="fields_input">
                            <label><h:outputText value="#{locale.title}"/></label>
                            <h:selectOneMenu value="#{CustomerBean.nv108}">  
                                <f:selectItems value="#{CustomerBean.selectItems}" />  
                            </h:selectOneMenu>

                                            </div>
                                            <div class="fields_input">
                                                <label><h:outputText value="#{locale.fname}"/>*:</label>&nbsp;
                                                <h:inputText value="#{CustomerBean.nv102}" id="firstname" styleClass="required ">                                      
                                                </h:inputText>

                                            </div>
                                            <div class="fields_input">
                                                <label><h:outputText value="Chữ lót"/>*:</label>&nbsp;
                                                <h:inputText value="#{CustomerBean.nv127}"  styleClass="required ">                                      
                                                </h:inputText>

                                            </div>
                                            <div class="fields_input">
                                                <label><h:outputText value="#{locale.lname}"/>*:</label>&nbsp;                                     
                                                <h:inputText value="#{CustomerBean.nv103}" id="lastname" lang="firstname" styleClass="required"></h:inputText>
                                                </div>

                                            </div>
                                            <div class="form-right">
                                                <div class="fields_input">
                                                    <label> <h:outputText value="#{locale.sex}"/>*:</label>
                                                <h:selectOneRadio value="#{CustomerBean.nv107}" styleClass="feild_sex"  style="width:100px;"   >
                                                    <f:selectItem itemValue="M" itemLabel="#{locale.employeeSexMale}" />
                                                    <f:selectItem itemValue="F" itemLabel="#{locale.employeeSexFmale}"/>                                                     
                                                </h:selectOneRadio>
                                            </div>
                                            <div class="fields_input">                                       
                                                <label><h:outputText value="#{locale.dateBorn}"/>*:</label>&nbsp;
                                                <input type="text" id="leavedate1" name="leavedate1"  class="input_fields required date"  
                                                       value="<h:outputText value="#{CustomerBean.nd118}"> <f:convertDateTime pattern="dd/MM/yyyy"/></h:outputText>"/>

                                                </div>
                                                <div class="fields_input">
                                                    <label><h:outputText value="#{locale.status_marries}"/>:</label>
                                                <h:selectOneMenu value="#{CustomerBean.nv109}"  >                                           
                                                    <f:selectItem itemLabel="#{locale.status_family_true}" itemValue="1" />
                                                    <f:selectItem itemLabel="#{locale.status_family_false}" itemValue="2" />
                                                    <f:selectItem itemLabel="#{locale.status_family_orther}" itemValue="3" />
                                                </h:selectOneMenu>
                                            </div>

                                        </div>
                                        <div class="popup-footer">
                                            <h:outputText value="#{CustomerBean.message}" id="mesage4" styleClass="mesage"/>
                                            <a4j:commandButton onclick="showPleaseWait();"  action="#{CustomerBean.saveCustomer}"  oncomplete="hidePleaseWait();$j('.messa').text('');"  styleClass="buttonsave savewait" value="#{locale.save}" reRender="lang,mesage4,pn100,formcompany">
                                                <f:param value="1" name="nn117"/>
                                                <f:param value="4" name="fn600"/>
                                                 <f:param value="#{k100Controller.PK100}" name="id"/>
                                            </a4j:commandButton>
                                            <h:inputHidden value="#{CustomerBean.flag}" id="flag" />                                            
                                            <h:inputHidden value="#{CustomerBean.editpage}" id="editpage"/>
                                          
                                            <h:inputHidden value="#{CustomerBean.fn850}" id="fn850" />
                                            <h:inputHidden value="#{CustomerBean.nv113}" id="nv113" />                                       
                                            <h:inputHidden value="#{CustomerBean.ni105}" id="ni105" />
                                            


                                        </div>


                                    </h:panelGroup>     
                                </div>
            --%>
            <div class="addEm">
                <h:panelGroup>                                   
                    <div class="form-left">
                        <div class="fields_input">
                            <label><h:outputText value="#{locale.title}"/></label>
                            <h:selectOneMenu value="#{CustomerBean.nv108}" styleClass="nv108">  
                                <f:selectItems value="#{CustomerBean.selectItems}" />  
                            </h:selectOneMenu>

                        </div>
                        <div class="fields_input">
                            <label><h:outputText value="#{locale.fname}"/>*:</label>&nbsp;
                            <h:inputText value="#{CustomerBean.nv102}" onkeyup="this.value=this.value.toUpperCase();" styleClass="required nv102">                                      
                            </h:inputText>

                        </div>
                        <div class="fields_input">
                            <label><h:outputText value="Chữ lót"/>*:</label>&nbsp;
                            <h:inputText value="#{CustomerBean.nv127}" onkeyup="this.value=this.value.toUpperCase();" styleClass="required nv127">                                      
                            </h:inputText>

                        </div>
                        <div class="fields_input">
                            <label><h:outputText value="#{locale.lname}"/>*:</label>&nbsp;                                     
                            <h:inputText value="#{CustomerBean.nv103}" onkeyup="this.value=this.value.toUpperCase();" lang="firstname" styleClass="required nv103"></h:inputText>
                            </div>

                        </div>
                        <div class="form-right">
                            <div class="fields_input" style="display: none;">
                                <label> <h:outputText value="#{locale.sex}"/>*:</label>
                            <h:selectOneRadio value="#{CustomerBean.nv107}" styleClass="feild_sex nv107"  style="width:100px;"   >
                                <f:selectItem itemValue="M" itemLabel="#{locale.employeeSexMale}" />
                                <f:selectItem itemValue="F" itemLabel="#{locale.employeeSexFmale}"/>                                                     
                            </h:selectOneRadio>
                        </div>
                        <div class="fields_input">                                       
                            <label><h:outputText value="#{locale.dateBorn}"/>*:</label>&nbsp;
                            <input type="text" id="leavedate1" name="leavedate1"  class="input_fields required date nd118"  
                                   value="<h:outputText value="#{CustomerBean.nd118}"> <f:convertDateTime pattern="dd/MM/yyyy"/></h:outputText>"/>

                            </div>
                            <div class="fields_input">
                                <label><h:outputText value="#{locale.status_marries}"/>:</label>
                            <h:selectOneMenu value="#{CustomerBean.nv109}"  styleClass="nv109">                                           
                                <f:selectItem itemLabel="#{locale.status_family_true}" itemValue="1" />
                                <f:selectItem itemLabel="#{locale.status_family_false}" itemValue="2" />
                                <f:selectItem itemLabel="#{locale.status_family_orther}" itemValue="3" />
                            </h:selectOneMenu>
                        </div>
                        <div class="fields_input">
                            <label><h:outputText value="Nguồn thông tin" />:</label>&nbsp;
                            <h:selectOneMenu value="#{CustomerBean.FK300}" styleClass="fk300">
                                <f:selectItems value="#{CustomerBean.listComboK300}"/>
                            </h:selectOneMenu>
                        </div>
                        <div class="fields_input">
                            <label><h:outputText value="Status" />:</label>&nbsp;
                            <h:selectOneMenu value="#{CustomerBean.FK330}" styleClass="fk330">
                                <f:selectItems value="#{CustomerBean.listComboK330}"/>
                            </h:selectOneMenu>
                        </div>
                    </div>
                    <div class="popup-footer">
                        <h:outputText value="#{CustomerBean.message}" id="mesage5" styleClass="mesage"/>
                        <a4j:commandButton onclick="showPleaseWait();"    oncomplete="hidePleaseWait();$j('.messa').text('');"  styleClass="buttonsave savewait saveCustomerAJ" value="#{locale.save}" reRender="mesage5">
                            <f:param value="3" name="fn600"/>
                            <f:param value="#{k100Controller.PK100}" name="id"/>
                        </a4j:commandButton>




                    </div>


                </h:panelGroup>     
            </div>

        </h:panelGroup>

    </a4j:form>
</f:view>